<?php

// 建立链接

try {
    $db = @new PDO("mysql:host=127.0.0.1;dbname=school88;charset=utf8","root","root");

    var_dump($db);

    $sql = "update stu set age=age+5 where cid=1";

    $sql = "delete from stu where name like '%学并思%'";

    $res = $db->exec($sql);

    // var_dump($res);

    $sql = "select * from stu where sex='男'";

    $res = $db->query($sql);

    $data = $res->fetchAll(PDO::FETCH_ASSOC);

    var_dump($data);
} catch (PDOException $e) {
    var_dump($e);
}